package com.itheima.address;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class GetInteAddress {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress byAddress = InetAddress.getByName("XB-20200704WLMB");//确定主机名称
        System.out.println(byAddress);
        String hostName = byAddress.getHostName();
        System.out.println(hostName);//获取Ip地址主机名
        String hostAddress = byAddress.getHostAddress();
        System.out.println(hostAddress);//获取Ip地址


    }
}
